import {LogLanguage} from "../dist/index.js"

// 简单的字符串测试
const simpleTest = 'INFO Test with "quoted string" and \'single quoted\''

console.log("Debugging string recognition...")
console.log(`Input: ${simpleTest}`)

try {
  const tree = LogLanguage.parser.parse(simpleTest)
  console.log("Parse successful!")
  
  // 遍历所有节点
  console.log("\nAll nodes:")
  tree.iterate({
    enter: (node) => {
      const text = simpleTest.slice(node.from, node.to)
      console.log(`- ${node.name}: "${text}" (${node.from}-${node.to})`)
    }
  })
  
  // 特别检查字符串
  console.log("\nLooking for String nodes:")
  tree.iterate({
    enter: (node) => {
      if (node.name === "String") {
        const text = simpleTest.slice(node.from, node.to)
        console.log(`Found String: "${text}"`)
      }
      if (node.name === "StringExpression") {
        const text = simpleTest.slice(node.from, node.to)
        console.log(`Found StringExpression: "${text}"`)
      }
    }
  })
  
} catch (error) {
  console.log(`Parse failed: ${error.message}`)
} 